#include<iostream>
using namespace std;
const int N = 5e5 + 10;
typedef long long LL;
int arr[N];
LL tree[N];
int n, m;
int lowbit(int x)
{
	return x & -x;
}

void add(int x, int v)
{
	for (int i = x; i <= n; i += lowbit(i)) {
		tree[i] += v;
	}
}

LL sum(int x)
{
	LL ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tree[i];
	}
	return ans;
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
		add(i, arr[i]);
	}
	while (m--) {
		int t, a, b;
		scanf("%d%d%d", &t, &a, &b);
		if (t == 1) {
			add(a, b);
		}
		else {
			printf("%lld\n", sum(b) - sum(a - 1));
		}
	}
	return 0;
}